<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>Examples of Using YUI Custom Event</title>
<meta name='author' content='Caridy Patino (caridy at gmail.com)' />
<!-- Reset and Fonts -->
<link rel="stylesheet" type="text/css" href="../assets/example.css">
<!-- YUI Basement Style -->
<script type="text/javascript" src='http://yui.yahooapis.com/2.2.2/build/utilities/utilities.js'></script>
<script type="text/javascript">
(function() {
	
	var Foo = function () {
	  var obj = {};
	  // private stuff
	  var callback = {
			success: function (o) {
				if (o.responseText != 'undefined') {
					// content sustitution here...
					obj.onArrive.fire ({laLegende:'Legende Value...', response:o.responseText});
				}
			},
			failure:function (o) {}
	  }, 
	  handle = null;
		
	  // public vars
	  obj.onArrive = new YAHOO.util.CustomEvent('onArrive'); 
	
	  // public methods
	  obj.loadURL = function ( uri ) {
		 handle = YAHOO.util.Connect.asyncRequest('GET', uri, callback);
	  };
	  return obj;
	}();
	
	YAHOO.example.Snapshot = function ( layer, args ) {
		alert (args[0].response);
	};	
	YAHOO.example.FormValidation = function ( layer, args ) {
		alert (args[0].laLegende);
	};	

	Foo.onArrive.subscribe ( YAHOO.example.Snapshot );
	Foo.onArrive.subscribe ( YAHOO.example.FormValidation );
		
    YAHOO.util.Event.addListener(window, "load", Foo.loadURL ('../dispatcher/framework/pages/simple.php') ); 
    
})();

</script>
</head>
<body id="cms-body">

<div id="doc">

  <div class="path">
	  <a href="http://bubbling.comarq.com/" target="_top">Bubbling Library</a> &gt; <a href="http://bubbling.comarq.com/eng/examples" target="_top">Examples</a>
  </div>

  <h1>Examples of Using the YUI Custom Event</h1>
  <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas sit amet metus. Nunc quam elit, posuere nec, auctor in, rhoncus quis, dui. Aliquam erat volutpat. Ut dignissim, massa sit amet dignissim cursus, quam lacus feugiat.Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas sit amet metus. Nunc quam elit, posuere nec, auctor in, rhoncus quis, dui. </p>

</div>



</body>
</html>